package com.Servlet;

import cn.dsna.util.images.ValidateCode;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "VcServlet", value = "/vc")
public class VcServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ValidateCode vc = new ValidateCode(150,50,4,10);
        String code = vc.getCode();
        HttpSession session = request.getSession();
        session.setAttribute("code",code);
        vc.write(response.getOutputStream());
    }
}
